package com.example.demo.AOP;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class TestAop {

    //定义切点方法
    @Pointcut("execution(* com.example.demo.Controller.UserController.*(..))")
    public void pointcut(){}

    @Before("pointcut()")
    public void doBefore(){
        System.out.println("这是前置通知");
    }

    @Around("pointcut()")
    public void doAround(ProceedingJoinPoint point) throws Throwable {
        System.out.println("环绕通知的前置方法");
        Object result=point.proceed();
        System.out.println("环绕通知的后置方法");

    }

}
